<template>
  <div class="type-block">
    <div class="feed-label feed-label-top" v-if="item.top">
      置顶
    </div>
    <div class="feed-label feed-label-top" v-if="item.good">
      精华
    </div>
    <div class="feed-label feed-label-other" v-if="!item.top&&!item.good">
      {{_title}}
    </div>
  </div>
</template>

<script>
  import {getTopicType} from '../utils/index'

  export default {
    name: 'type-block',
    props: ['item'],
    data() {
      return {}
    },
    computed: {
      _title() {
        return getTopicType(this.item.tab)
      }
    }
  }
</script>

<style lang="scss" scoped>
  .feed-label {
    font-size: 12px;
    border-radius: 4px;
    padding: 0 5px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    flex-shrink: 0;
    box-sizing: border-box;
    &.feed-label-other {
      background-color: $type-block-bg;
      color: #333;
    }
    &.feed-label-top {
      background-color: $light-color;
      color: $type-block-font;
    }
  }
</style>
